<?php
/**
 * 课程目录
 * Class CourseAction
 */
class CourseAction extends BaseAction
{
    /**
     * 课程列表
     */
    public function index()
    {

    }

    /**
     * 课程下面课程信息
     */
    public function item()
    {
        $cid = intval(I('get.itemid'));
        $this->checkEmpty($cid, '必须给出cid');
        $StudyModel = D('Study');
        $map = array();
        $map['cid'] = $cid;
        $count = $StudyModel->where($map)->count();
        $Page = parent::getPage($count);
        $studys = $StudyModel->where($map)->limit($Page['limit'])->select();
        if(count($studys)==0){
            echo "<script language='javascript'>alert('没有相关视频！');history.go(-1);</script>";
        }else{
        $this->assign('page', $Page['page']);
        $this->assign('studys', $studys);
        $this->display();
        }
    }
}